package com.sola_aventuro.adventure.gui.helpers;

import java.util.Locale;
import java.util.ResourceBundle;

import com.sola_aventuro.adventure.model.ConditionType;

public class Strings {
	Locale locale;
	ResourceBundle messages;

	public Strings() {
		String language = System.getProperty("user.language");
		String country = System.getProperty("user.region");
		try {
			locale = new Locale(language, country);
		} catch (NullPointerException e) {
			locale = new Locale(language);
		}
		messages = ResourceBundle.getBundle("com.sola_aventuro.adventure.gui.helpers.i18n.messages", locale);
	}
	
	public String _(String key) {
		return messages.getString(key);
	}
	public String getString(String key) {
		return messages.getString(key);
	}
	
	public String[] getConditionTypeList() {
		String result[] = new String[ConditionType.values().length];
		for (int i = 0; i < ConditionType.values().length; i++) {
			result[i] = _(ConditionType.values()[i].value().toLowerCase());
		}
		return result;
	}

	public static void main(String[] args) {
		Strings str = new Strings();
		System.out.println();
		for (int i = 0; i < str.getConditionTypeList().length; i++) {
			System.out.println(str.getConditionTypeList()[i]);
		}
		System.out.println(str._("race"));
		System.out.println(str._("quit"));
	}
}
